<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button,input {
            width: 400px;
            height: 30px;
            outline: none;
            margin: 5px 0;
        }
        button {
            height: 35px;
        }
    </style>
</head>

<body>
    <div class="videoDemo shadow">
        <video id="video" style="width: 800px;height: 600px;" autoplay loop controls>
        </video>
    </div>
    WEBRTC服务地址<input type="text" id="webrtc-url" value="http://192.168.1.100:8000"><br>
    RTSP直播流源地址<input type="text" id="video-url" value="rtsp://192.168.1.15:5544/live/a"><br>
    <button onclick="play()">播放</button>
    <br>
    
    <script src="webrtcstreamer.js"></script>
    <script>
        function play() {
            let webrtc_url = document.getElementById("webrtc-url").value;
            let video_url = document.getElementById("video-url").value;
            //连接后端的IP地址和端口
            let webRtcServer = new WebRtcStreamer("video",webrtc_url);
            //向后端发送rtsp地址     
            webRtcServer.connect(video_url);
        }

    </script>
</body>

</html>